<template>
<div>
  <mt-header title="意见反馈" fixed>
    <mt-button  slot="right" @click.native="sendFeedback">发送</mt-button>
  </mt-header>
  <mt-field class="feed-text" label="" placeholder="请描述需要反馈的问题，以便于我们更快的处理您的反馈" type="textarea" rows="10" v-model="feedback"></mt-field>
</div>
</template>

<script>
import axios from '@/api/axiosApi'
// 导入Toast组件
import { Toast } from 'mint-ui'

export default {
  data () {
    return {
      feedback: ''
    }
  },
  methods: {
    sendFeedback () {
      const openId = localStorage.getItem('openId')
      if (openId === null) {
        Toast('请先登录，并完善个人信息')
        return
      }
      const _self = this
      axios.post('/feedback/addOrUpdateFeedback', {
        userId: openId,
        content: this.feedback,
        valid: 1
      }, (data) => {
        _self.feedback = ''
        Toast('意见反馈成功')
      })
    }
  }
}
</script>

<style>

.feed-text{
  margin-top: 45px;
}

</style>
